package com.cplatform.cat;

public class WindowMaxValue {
    public static void main(String[] args) {
        int[] nums = new int[]{1,3,-1,-3,5,3,6,7};
        maxSlidingWindow(nums,3);
    }
    public static int[] maxSlidingWindow(int[] nums, int k) {
        int len = nums.length;
        int count = len - k + 1;
        int[] result = new int[count];
        for(int i = 0;i < count;i++){
            int max = Integer.MIN_VALUE;
            for(int j = i;j < i+k;j++){
                max = Math.max(max,nums[j]);
            }
            result[i] = max;
        }
        return result;

    }
}
